from datetime import datetime
from typing import List, Union, Literal

from sqlmodel import SQLModel, Field
from sqlalchemy import Column, Text


class SystemConfig(SQLModel, table=True):
    __tablename__ = "system_config"

    id: int = Field(default=None, primary_key=True, index=True, nullable=False)
    type: str = Field(default='', max_length=30, nullable=False)
    name: str = Field(default='', max_length=60, nullable=False)
    value: str = Field(sa_column=Column(Text()))
    create_time: datetime = Field(default_factory=datetime.utcnow, nullable=False)
    update_time: datetime = Field(default_factory=datetime.utcnow, sa_column_kwargs={'onupdate': datetime.utcnow}, nullable=False)

